import {
  createRouter,
  createWebHistory,
  createWebHashHistory
} from 'vue-router';

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    // 捕获所有未匹配的路由(404)
    {
      path: '/:path(.*)*',
      component: () => import('@/views/404.vue')
    },
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/login',
      component: () => import('@/views/Login.vue')
    },

    {
      path: '/blog',
      component: () => import('@/layout/BlogLayout.vue'),
      redirect: '/blog/home',
      children: [
        {
          path: 'home',
          component: () => import('@/views/Home.vue')
        }
      ]
    }
  ]
});

export default router;
